/*
 * Copyright (c) 2016- 2021 qolome.com Inc. All Rights Reserved. ProjectName: qolome-excel Title: ExcelBuild.java Date:
 * 2021年4月14日 下午9:02:25
 */
package com.qolome.excel.utils;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

/**
 * Excel构建
 * 
 * @author <a href="mailto:jiangfeng@qolome.com">Qolome</a>
 * @version 1.0
 * @since 2021年4月14日 下午9:02:25
 */
public class ExcelBuild {

    public static final String IN_FILE_NAME = "D:/template.xlsx";
    public static final String OUT_FILE_NAME = "D:/test" + System.currentTimeMillis() + ".xlsx";

    public static void main(String[] args) {
        try (Workbook workbook = new XSSFWorkbook(IN_FILE_NAME)) {
            try (FileOutputStream fileOutputStream = new FileOutputStream(new File(OUT_FILE_NAME))) {
                workbook.cloneSheet(0);
                workbook.write(fileOutputStream);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
